package com.market.product.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.market.product.dao.ProductDao;

@Controller
public class ProDeleteController {
	@Autowired
	private ProductDao productDao;
	
	@RequestMapping("/productDelete.do")
	public String deleteProcess(@RequestParam("p_code") int p_code,
			@RequestParam("pageNum") int pageNum,
			@RequestParam("searchMarket") String searchMarket,
			@RequestParam("searchCategory") String searchCategory){
		
		productDao.delete(p_code);
		/* 현재 테이블의 PK를 참조하는
		 * 테이블 삭제가 선행되게끔 해야 해
		 */
		return "redirect:/productList.do?pageNum="+pageNum+"&searchMarket="+searchMarket+"&searchCategory="+searchCategory;
	}
	
}
